﻿Public Class ucCustomer

    Private Sub cmbDOBYear_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbDOBYear.SelectedIndexChanged
        Dim i As Integer
        For i = 1950 To Date.Now.Year
            cmbDOBYear.BindingManager.AddNew()
        Next
    End Sub
    Public Function ucValidateCustomer() As Boolean
        If txtFirstName.Text = "" Or txtLastName.Text = "" Or txtHomeAddress.Text = "" Or txtCurAddress.Text = "" Or txtSocialId.Text = "" Or txtPhone.Text = "" Or txtEmail.Text = "" Then
            MsgBox("Fields can't be blank!!")
            txtFirstName.Focus()
            Return False
        End If
        If txtEmail.Text Like "*@[A-Z,a-z,0-9]*.*" Then
            MsgBox("Regular!!")
            Return True
        Else
            Beep()
            MsgBox("Don't regular!!")
            txtEmail.Text = ""
            txtEmail.Focus()
            Return False
        End If
        If txtPhone.Text Like "[0-9]" Then
            MsgBox("Regular!!!")
            Return True
        Else
            Beep()
            MsgBox("Don't Regular")
            txtPhone.Text = ""
            txtPhone.Focus()
            Return False
        End If
        Return True
    End Function
End Class
